<?xml version='1.0' encoding='UTF-8' ?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:c="http://java.sun.com/jstl/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
    xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">
	
	<p:dialog widgetVar="user_edit_var" id="user_edit_dialog" resizable="false"
		modal="true" width="720" header="#{userBean.model eq comm.m_a ? msgs.btnNew :(userBean.model eq comm.m_q ? msgs.btnQuery : (userBean.model eq comm.m_m ? msgs.btnEdit : (userBean.model eq comm.m_r ? msgs.btnRemove : '')))}用户信息">
		<h:form prependId="false" id="user_edit_form">
			<p:focus for="user_edit_form"/>
			<h:panelGrid columns="6" columnClasses="column1,column2,column1,column2,column1,column2">
				<h:outputText value="注册帐号：" />
				<h:column>
					<p:inputText value="#{userBean.instance.account}" maxlength="50"
						disabled="#{!(userBean.model eq comm.m_a)}" label="注册帐号：">
						<f:validator validatorId="validator" />
						<f:attribute name="req_trim" value="true"/>
						<f:attribute name="req_notnull" value="true" />
						<f:attribute name="max_length" value="50"/>
					</p:inputText>
					<h:outputText value="*" style="color: red;"/>
				</h:column>
				<h:outputText value="注册密码：" />
				<h:column>
					<p:inputText value="#{userBean.instance.password}" maxlength="50"
						disabled="#{userBean.model eq comm.m_q}" label="注册密码：">
						<f:validator validatorId="validator" />
						<f:attribute name="req_trim" value="true"/>
						<f:attribute name="req_notnull" value="true" />
						<f:attribute name="max_length" value="50"/>
					</p:inputText>
					<h:outputText value="*" style="color: red;"/>
				</h:column>
				<h:outputText value="校验密码：" />
				<h:column>
					<p:inputText value="#{userBean.instance.validPassword}" maxlength="50"
						disabled="#{userBean.model eq comm.m_q}" label="校验密码：">
						<f:validator validatorId="validator" />
						<f:attribute name="req_trim" value="true"/>
						<f:attribute name="req_notnull" value="true" />
						<f:attribute name="max_length" value="50"/>
					</p:inputText>
					<h:outputText value="*" style="color: red;"/>
				</h:column>
			
				<h:outputLabel value="用户编号：" />
				<h:column>
					<p:inputText value="#{userBean.instance.code}" maxlength="50"
						disabled="#{userBean.model eq comm.m_q}" label="用户编号：">
						<f:validator validatorId="validator" />
						<f:attribute name="req_trim" value="true"/>
						<f:attribute name="req_notnull" value="true" />
						<f:attribute name="max_length" value="50"/>
					</p:inputText>
					<h:outputText value="*" style="color: red;"/>
				</h:column>
				<h:outputLabel value="用户名称：" />
				<h:column>
					<p:inputText value="#{userBean.instance.name}" maxlength="50"
						disabled="#{userBean.model eq comm.m_q}" label="用户名称：">
						<f:validator validatorId="validator" />
						<f:attribute name="req_trim" value="true"/>
						<f:attribute name="req_notnull" value="true" />
						<f:attribute name="max_length" value="50"/>
					</p:inputText>
					<h:outputText value="*" style="color: red;"/>
				</h:column>
				<h:outputLabel value="用户生日：" />
				<p:calendar value="#{userBean.instance.birth}" pattern="yyyy-MM-dd"
					disabled="#{userBean.model eq comm.m_q}" navigator="true" locale="cn" />
				
				<h:outputLabel value="用户性别：" />
				<h:selectOneMenu value="#{userBean.instance.sex}" disabled="#{userBean.model eq comm.m_q}" 
					styleClass="ui-inputfield ui-widget ui-state-default ui-corner-all">
					<f:selectItem itemLabel="男" itemValue="男"/>
					<f:selectItem itemLabel="女" itemValue="女"/>
				</h:selectOneMenu>
				<h:outputLabel value="固定电话：" />
				<p:inputText value="#{userBean.instance.telephone}" maxlength="50"
					disabled="#{userBean.model eq comm.m_q}" label="固定电话：">
				</p:inputText>
				<h:outputLabel value="移动电话：" />
				<p:inputText value="#{userBean.instance.mobile}" maxlength="50"
					disabled="#{userBean.model eq comm.m_q}" label="移动电话：">
				</p:inputText>
				
				<h:outputLabel value="身份证号：" />
				<p:inputText value="#{userBean.instance.card}" maxlength="30"
					disabled="#{userBean.model eq comm.m_q}" label="身份证号：">
					<f:validator validatorId="validator" />
					<f:attribute name="sys_regular" value="onlynumber"/>
					<f:attribute name="max_length" value="30"/>
				</p:inputText>
				<h:outputLabel value="QQ联系：" />
				<p:inputText value="#{userBean.instance.qq}" maxlength="30"
					disabled="#{userBean.model eq comm.m_q}" label="QQ联系：">
					<f:validator validatorId="validator" />
					<f:attribute name="sys_regular" value="onlynumber"/>
					<f:attribute name="max_length" value="30"/>
				</p:inputText>
				<h:outputLabel value="msn联系：" />
				<p:inputText value="#{userBean.instance.msn}" maxlength="100"
					disabled="#{userBean.model eq comm.m_q}" label="msn联系：">
				</p:inputText>
				
				<h:outputLabel value="电子邮件：" />
				<p:inputText value="#{userBean.instance.email}" maxlength="120"
					disabled="#{userBean.model eq comm.m_q}" label="电子邮件：">
				</p:inputText>
				<h:outputLabel value="邮政编码：" />
				<p:inputText value="#{userBean.instance.zip}" maxlength="10"
					disabled="#{userBean.model eq comm.m_q}" label="邮政编码：">
					<f:validator validatorId="validator" />
					<f:attribute name="sys_regular" value="onlynumber"/>
					<f:attribute name="max_length" value="10"/>
				</p:inputText>
			</h:panelGrid>
			
			<h:panelGrid columns="2" columnClasses="column1">
				<h:outputLabel value="家庭住址：" />
				<p:inputTextarea value="#{userBean.instance.address}" maxlength="250"
					style="width: 590px; height: 30px;" label="家庭住址："
					disabled="#{userBean.model eq comm.m_q}" autoResize="true"/>
				
				<h:outputLabel value="备注：" />
				<p:inputTextarea value="#{userBean.instance.note}" maxlength="255"
					style="width: 590px; height: 30px;" label="备注："
					disabled="#{userBean.model eq comm.m_q}" autoResize="true"/>
				
				<h:outputText value="#{msgs.valid}：" />
				<h:selectOneRadio value="#{userBean.instance.status}" 
					disabled="#{userBean.model eq comm.m_q}" label="#{msgs.valid}：">
					<f:validator validatorId="validator" />
					<f:attribute name="req_notnull" value="true" />
					<f:selectItem itemLabel="#{msgs.valid_y}" itemValue="1"/>
					<f:selectItem itemLabel="#{msgs.valid_n}" itemValue="1024"/>
				</h:selectOneRadio>
			</h:panelGrid>
			<div style="text-align: center;">
				<p:commandButton icon="#{comm.saveClass}" value="#{msgs.btnSave}" action="#{userBean.doAction}"
					oncomplete="handleUser(xhr, status, args);" update=":option_info"
					disabled="#{userBean.model eq comm.m_q}">
				</p:commandButton>
				<p:commandButton icon="#{comm.cancelClass}" value="#{msgs.btnCancel}" type="button" onclick="user_edit_var.hide();"/>
			</div>
		</h:form>
		<script type="text/javascript">
			function handleUser(xhr, status, args) {
				if(args.option_result == 'success') {
					user_edit_var.hide();
				}
			}
		</script>
	</p:dialog>
	
</ui:composition>